<?php

namespace app\common\model;

use app\extra\BaseModel;


class Province extends BaseModel
{
    /**
     * 添加额外参数
     * @param $item
     */
    public function setAddedField(&$item){
        // $item['public_desc'] = \app\extra\DBCont::getPublishStatus($item['publish']);
        $item['school_num'] = model('school')->where('province_id', $item['id'])->count();

            $where[]=['province_id','=', $item['id']];
        $where[]=['recruit','=', 1];
        $school =model('school')->getList($where);
        $item['speciality_num']=0;
        foreach ($school as $v){
            $item['speciality_num'] +=$v['speciality_num'];
        }

    }
}
